home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #4 / Amiga Plus CD - 2000 - No. 4.iso / Tools / Grafik / Misc / ImageEnginer / ARexx / OilPaint.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1996-09-02  |  1.6 KB  |  79 lines

  1. /* Image Engineer ARexx macro script        */
  2. /* by Simon Edwards                         */
  3. /* 2/9/96                                   */
  4. /* This fakes a sort of oil painting effect */
  5.  
  6. Options results
  7. signal on error            /* Setup a place for errors to go */
  8.  
  9. if arg()==0 then exit
  10.  
  11. 'GET_NUMBER "Maximum distance to displace" 1 128 "Ok|Cancel" 2 SLIDER'
  12. distance=RESULT
  13.  
  14. source=arg(1)
  15.  
  16. 'PROJECT_INFO' arg(1) 'TYPE'
  17. if RESULT=='COLOUR' then
  18.     do
  19.     'CONVERT_TO_GREY' arg(1)
  20.     workingproject=RESULT
  21.     CALL disperse
  22.  
  23.     CLOSE workingproject
  24.  
  25.     end
  26.  
  27. else
  28.     do
  29.     workingproject=arg(1)
  30.     CALL disperse
  31.  
  32.     end
  33.  
  34. if distance>12 then distance=12
  35.  
  36. 'MEDIAN' rough 2*distance-1 2*distance-1
  37. CLOSE rough
  38.  
  39. exit
  40.  
  41.  
  42. disperse:
  43.     'NOISE' workingproject '100 INTENSITY RANDOM'
  44.     tmp1=RESULT
  45.     MARK tmp1 ALPHA
  46.     MARK source PRIMARY
  47.     DISPLACE distance 0 BEST
  48.     dis1=RESULT
  49.     CLOSE tmp1
  50.     
  51.     'NOISE' workingproject '100 INTENSITY RANDOM'
  52.     tmp1=RESULT
  53.     MARK tmp1 ALPHA
  54.     MARK dis1 PRIMARY
  55.     DISPLACE 0 distance BEST
  56.     rough=RESULT
  57.     CLOSE tmp1
  58.     CLOSE dis1
  59.     return
  60. exit
  61.  
  62. /*******************************************************************/
  63. /* This is where control goes when an error code is returned by IE */
  64. /* It puts up a message saying what happened and on which line     */
  65. /*******************************************************************/
  66. error:
  67. if RC=5 then do            /* Did the user just cancel us? */
  68.     IE_TO_FRONT
  69.     LAST_ERROR
  70.     'REQUEST "'||RESULT||'"'
  71.     exit
  72. end
  73. else do
  74.     IE_TO_FRONT
  75.     LAST_ERROR
  76.     'REQUEST "Error detected!!!'||D2C(10)||'Image Engineer error message is as follows'||D2C(10)||result||D2C(10)||'Script failed on line '||SIGL||'"' 'Doh!'
  77.     exit
  78. end
  79.